Page(


    {
    /**
     * 初始化数据
     */
    data: {
        userid: '',
        ename: '',
        phone: '',

    },
    /**
     * 监听工号输入
     */
    listenerUseridInput: function (e) {
        this.data.userid = e.detail.value;
        
    },
    /**
     * 监听英文名输入
     */
    listenerEnameInput: function (e) {
        this.data.ename = e.detail.value;
    },
    /**
     * 监听手机号输入
     */
    listenerPhoneInput: function (e) {
        this.data.phone = e.detail.value;
    },
    /**
     * 监听登录按钮
     */
    listenerLogin: function () {
        var that=this
         if(this.data.userid!=''&&this.data.ename!=''&&this.data.phone!=''){
        //打印收入账号和密码
        wx.request({
            url: 'http://app.benqmedicalcenter.com:8090/LoginCheck.ashx',
            data: {
                userid: this.data.userid,
                ename: this.data.ename,
            },
            method: 'GET',
            success: function (res) {
                console.log(res.data.state)
              if(res.data.state=="success"){
                  /*wx.navigateTo({
                    url: '../ui/test',
                    success: function(res){
                      // success
                    },
                    fail: function() {
                      // fail
                    },
                    complete: function() {
                      // complete
                    }
                  })*/
                  wx.setStorageSync('userid',that.data.userid)
                  wx.setStorageSync('ename',that.data.ename)
                  wx.setStorageSync('phone',that.data.phone)
                  wx.redirectTo({
                      url: '../repair/repair',
                      success: function(res){
                          // success
                      },
                      fail: function() {
                          // fail
                      },
                      complete: function() {
                          // complete
                      }
                  })
              }else {
                  wx.showToast({
                      title: '工号与英文名不匹配',
                      icon: 'loading',
                      duration: 2000
                  })
              }
            },
            fail: function (res) {
                wx.showToast({
                    title: '请检查网络连接',
                    icon: 'loading',
                    duration: 2000
                })
            }
        })}else
         {
             wx.showToast({
                 title: '检查信息是否填写完整',
                 icon: 'success',
                 duration: 2000
             })
         }
    },


    onLoad: function (options) {
        // 页面初始化 options为页面跳转所带来的参数
        this.setData(
            {
                userid:wx.getStorageSync('userid'),
                ename:wx.getStorageSync('ename'),
                phone:wx.getStorageSync('phone')
            }
        )
    },
    onReady: function () {
        // 页面渲染完成
    },
    onShow: function () {
        // 页面显示
    },
    onHide: function () {
        // 页面隐藏
    },
    onUnload: function () {
        // 页面关闭
    }
})